/**
 *  Document   : Zipcode
 *  Created on : 17 juil. 2008, 10:21:36
 *  Author     : Rivo
 */

package gla.centralhotel.model;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;


@Entity
@Table(name = "zipcode")
@NamedQueries({@NamedQuery(name = "Zipcode.findById", query = "SELECT z FROM Zipcode z WHERE z.id = :id"),
@NamedQuery(name = "Zipcode.findByZipcode", query = "SELECT z FROM Zipcode z WHERE z.zipcode = :zipcode"),
@NamedQuery(name = "Zipcode.findByCity", query = "SELECT z FROM Zipcode z WHERE z.city = :city")})
public class Zipcode implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Column(name = "id", nullable = false)
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    private Integer id;
    @Column(name = "zipcode", nullable = false)
    private String zipcode;
    @Column(name = "city", nullable = false)
    private String city;
//    @OneToMany(cascade = CascadeType.ALL, mappedBy = "refZipcode")
//    private Collection<Manager> managerCollection;

    public Zipcode() {
    }

    public Zipcode(Integer id) {
        this.id = id;
    }

    public Zipcode(Integer id, String zipcode, String city) {
        this.id = id;
        this.zipcode = zipcode;
        this.city = city;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getZipcode() {
        return zipcode;
    }

    public void setZipcode(String zipcode) {
        this.zipcode = zipcode;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

//    public Collection<Manager> getManagerCollection() {
//        return managerCollection;
//    }
//
//    public void setManagerCollection(Collection<Manager> managerCollection) {
//        this.managerCollection = managerCollection;
//    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Zipcode)) {
            return false;
        }
        Zipcode other = (Zipcode) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "gla.centralhotel.model.Zipcode[id=" + id + "]";
    }

}
